local SetLayer = class("SetLayer", require "widget/BaseUI")
 
function SetLayer.show()
    print("============SetLayer.show===============")
 
    local win = SetLayer.new()

    local data = getWndInitParamList()
    data.isRemoveResource = false
    data.imgTitle = nil
    data.bgImage = nil
    data.isShowCover = false,

    win:init(data)
    win:showWindow()

    return win

end

function SetLayer:ctor() 
    SetLayer.super:ctor();

end


function SetLayer:init(data)
    self:initWithParas(data)
    self.m_Json = ccs.GUIReader:getInstance():widgetFromJsonFile("image/ui/Json/LayerSet.json")
    self:setContentSize(self.m_Json:getContentSize())
    self.m_Json:setPositionX(-self.m_Json:getContentSize().width/2)
    self.m_Json:setPositionY(-self.m_Json:getContentSize().height/2)
    self:addChild(self.m_Json)
    
    self.m_SliderSound = self.m_Json:getChildByName("Slider_Sound")
    self.m_SliderSound:setTouchEnabled(true)
    self.m_SliderMusic = self.m_Json:getChildByName("Slider_Music")
    self.m_SliderMusic:setTouchEnabled(true)
    self.m_BtnPower = self.m_Json:getChildByName("bt_Power")
    self.m_BtnPower:setEnabled(true)
    self.m_BtnPower:setTouchEnabled(true)
    self.m_BtnPower:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    self.m_ImageViewPowerbg = self.m_Json:getChildByName("ImageView")
    self.m_LabelPowerClone = self.m_Json:getChildByName("Label_Power_Clone")
    self.m_LabelPower = self.m_Json:getChildByName("Label_Power")
    self.m_LabelTitle = self.m_Json:getChildByName("Label_Title")
    self.m_ImageViewtitlebg = self.m_Json:getChildByName("im_titlebg")
    self.m_BtnClose = self.m_Json:getChildByName("bt_Close")
    self.m_BtnClose:setEnabled(true)
    self.m_BtnClose:setTouchEnabled(true)
    self.m_BtnClose:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    self.m_ImageViewscale9bg = self.m_Json:getChildByName("im_scale9_bg")
    self.m_Panel = self.m_Json:getChildByName("Panel")
  
end


function SetLayer:onMenutClick(sender,eventType)
    if eventType == ccui.TouchEventType.ended then
        print ("=========SetLayer:onMenutClick m_BtnPower======================="..sender:getName())
        if sender == self.m_BtnPower then     
            print "=========SetLayer:onMenutClick m_BtnPower======================="
        elseif sender == self.m_BtnClose then     
            print "=========SetLayer:onMenutClick m_BtnClose======================="
            self:closeWindow()
        end
    end
end
 
return SetLayer